package org.theqcp.wow.model.player;

import org.theqcp.wow.model.mechanics.ClassType;

public abstract class Talent {

	private int level;
		
	private Talent() {
		
	}
	
	public Talent(int level) {
		this();
		this.level = level;
	}
	
	/**
	 * Used if/when the talen has the ability to change the stats of the player.
	 * 
	 * @param player
	 */
	public abstract void calculateStats(Player player);

	/**
	 * The name of the talent
	 * 
	 * @return
	 */
	public abstract String getName();
	
	/**
	 * The class that the talent is for.
	 * 
	 * @return
	 */
	public abstract ClassType forClass();
	
	/**
	 * Get the level of the talent
	 * 
	 * @return
	 */
	public int getLevel() {
		return level;
	}

	/**
	 * Set the level of the talent.
	 * 
	 * @param level
	 */
	public void setLevel(int level) {
		this.level = level;
	}

	@Override
	public boolean equals(Object arg0) {

		if(arg0 == null) return false;
		
		//must be a talent instance
		if(arg0 instanceof Talent) {
			
			Talent t = (Talent)arg0;
			
			if(t.getName() == null) return false;
			
			return t.getName().equals(this.getName());			
		}
		
		return false;
	}

	public String toString() {
		return String.format("%s - %s", this.getName(), this.getLevel());
	}
	
}
